<?php

class Brand extends AppModel {
    var $name = 'Brand';

    var $belongsTo = array(
            'Supplier' => array(
                'fields' => array('code', 'name')
        ),
            'User' => array(
                'foreignKey' => 'collector_id',
                'fields' => array('name')
        ),
    );

    var $validate = array(
        'name' => array(
                'notEmpty' => array(
                    'rule' => array('notEmpty'),
                    'message' => 'Brand name is required.',
                    'required' => true,
            ),
                'isUnique' => array(
                    'rule' => 'isUnique',
                    'message' => 'This brand name is already taken.',
            ),
        ),
        'supplier_id' => array(
                'notEmpty' => array(
                    'rule' => array('notEmpty'),
                    'message' => 'Supplier is required.',
                    'required' => true,
            ),
        )
    );


}
?>
